package com.converter;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;

/**
 * 自定义日期转换
 * 
 * @author Administrator
 *
 */
public class StringToDateConverter implements Converter<Object, Date> {

	@Override
	public Date convert(Object obj) {
		try {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			return sdf.parse(obj.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
